/*
 * Author  : Leo <lipf160627@163.com>
 * Created : 2025-7-27
 * Desc    : LED driver
 */

#pragma once

#include <stdint.h>

#include "driver/gpio.h"

class Led {
public:
    // 指定四个等IO，turn on电平
    Led(gpio_num_t pinFrontLeft, gpio_num_t pinFrontRight, gpio_num_t pinBackLeft, gpio_num_t pinBackRight, uint32_t onLevel);
    void on(gpio_num_t pin);
    void off(gpio_num_t pin);
    void toggle(gpio_num_t pin);
    void allOn();
    void allOff();
    void allToggle();

private:
    gpio_num_t pinFrontLeft;
    gpio_num_t pinFrontRight;
    gpio_num_t pinBackLeft;
    gpio_num_t pinBackRight;
    uint32_t onLevel;

    void init();
    bool validatePin(gpio_num_t pin);
};
